$(document).ready(function(){
	SB.LoginView = Backbone.View.extend({
		className: "span4",
		template: _.template($('#login-tpl').html()),
		
		render: function() {
			$(this.el).html(this.template());
			console.log(this.el);
			return this;
		}
	});
	
	SB.loginView = VM.createView('loginView', function() {
		return new SB.LoginView();
	});
	SB.loginView.render();
	
	$(document).on('click', '#login', function(){
	    $.fancybox(SB.loginView.el);
	});
	
	$(document).ajaxError(function(e, jqxhr, settings, exception)  {
		if (jqxhr.status == 401) {
			$.fancybox(SB.loginView.el);
		}
	});
});
